# -*- coding: utf-8 -*-
# filename: main.py

import web
from handle import Handle
import threading
from nbiot_server import nbiot_server
import sys

urls = (
    '/([.\w]*)?', 'Handle',
    # '/favicon.ico', 'Icon'
)

if __name__ == '__main__':
    # TODO:运行8个小时后线程出错
    # try:
    #     thd = threading.Thread(target=nbiot_server, args=(sys.argv[1],))
    # except Exception, err:
    #     thd = threading.Thread(target=nbiot_server, args=('8080',))
    #     print '>>>MAIN>>>', err
    # thd.setDaemon(True)
    # thd.start()
    app = web.application(urls, globals())
    app.run()

